/*!
   \file

   © 2011 Mark W. Gabby II

   This file is part of Rock Hunter.

   Rock Hunter is free software: you can redistribute it and/or modify it under the terms of the
   GNU General Public License as published by the Free Software Foundation, either version 3 of the
   License, or (at your option) any later version.

   Rock Hunter is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
   even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License along with Rock Hunter.
   If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

#define WIN32_LEAN_AND_MEAN
#ifndef WINVER
#define WINVER 0x501 // Windows XP
#endif
#include <windows.h>

#include <gl/gl.h>
#include <gl/wglext.h>

#include "Systems/Platform/Platform.hpp"
#include "Util/typedefs.hpp"
#include "Util/GlobalConstants.hpp"

/*!
   \brief
      When this class is created, it creates an OpenGL context which is automatically destroyed
      when it goes out of scope.
*/
class ScopedOpenGLContext
{
public:
   ScopedOpenGLContext();
   ~ScopedOpenGLContext();

   void Init( const uint32_t PixelFormatIndex = kNull32 );

   bool IsCurrent();
   void MakeCurrent();

   HDC GetDC();
   void ReleaseDC( HDC DeviceContext );
   HGLRC GetHGLRC();
private:
   HWND windowHandle;
   HGLRC openGLContextHandle;
};

